<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>漂亮的动态气泡背景js插件bubbly-bg.js|DEMO_jQuery之家-自由分享jQuery、html5、css3的插件库</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">
	<link rel="stylesheet" href="css/styles.css">
</head>
<body>
	<div class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>漂亮的动态气泡背景js插件bubbly-bg.js <span>Beautiful bubbly backgrounds in less than 1kB</span></h1>
			<div class="htmleaf-links">
				<a class="htmleaf-icon icon-htmleaf-home-outline" href="http://www.htmleaf.com/" title="jQuery之家" target="_blank"><span> jQuery之家</span></a>
				<a class="htmleaf-icon icon-htmleaf-arrow-forward-outline" href="http://www.htmleaf.com/html5/html5-canvas/201710114773.html" title="返回下载页" target="_blank"><span> 返回下载页</span></a>
			</div>
		</header>
		<div class="overlay">
		        <h3>点击下面的图片来查看不同的气泡背景效果</h3>
		        <div class="examples">
		            <div class="example"><img data-config-nr="0" src="img/config0.png"></div>
		            <div class="example"><img data-config-nr="1" src="img/config1.png"></div>
		            <div class="example"><img data-config-nr="2" src="img/config2.png"></div>
		            <div class="example"><img data-config-nr="3" src="img/config3.png"></div>
		        </div>
		</div>
	</div>
	
	<script src="js/bubbly-bg.js"></script>
	    <script>
	        bubbly();
	        let configs = [
	            {},
	            {
	                colorStart: "#111",
	                colorStop: "#422",
	                bubbleFunc: () => `hsla(0, 100%, 50%, ${Math.random() * 0.25})`
	            },
	            {
	                colorStart: "#4c004c",
	                colorStop: "#1a001a",
	                bubbleFunc: () => `hsla(${Math.random() * 360}, 100%, 50%, ${Math.random() * 0.25})`
	            },
	            {
	                colorStart: "#fff4e6",
	                colorStop: "#ffe9e4",
	                blur: 1,
	                compose: "source-over",
	                bubbleFunc: () => `hsla(${Math.random() * 50}, 100%, 50%, .3)`
	            }
	        ];
	        document.addEventListener("click", function (e) {
	            if (e.target.hasAttribute("data-config-nr")) {
	                document.body.removeChild(document.querySelector("canvas"));
	                bubbly(configs[e.target.getAttribute("data-config-nr")]);
	            }
	        });
	    </script>
</body>
</html>